<template>
  <div class="dashboard-container">
    <upload-excel :on-success="onSuccess">上传excel</upload-excel>
    <el-table :data="results">
      <el-table-column :label="item" :prop="item" :key="item" v-for="item in header" />
    </el-table>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import UploadExcel from "@/components/uploadExcel/index.vue";

export default {
  name: 'Dashboard',
  data() {
    return {
      header: [],
      results: []
    }
  },
  components: {UploadExcel},
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  methods: {
    onSuccess({header, results}) {
      this.header = header;
      this.results = results;
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
